<template>
  <div class="platform">
    <pageCardFormVue
      title="平台抽象信息"
      :pageCardConfig="platformConfig"
      v-model="formData"
    ></pageCardFormVue>
  </div>
</template>

<script lang="ts">
import { defineComponent, PropType, ref, watch } from 'vue'
import { pageCardFormVue } from '@/render/components/page-card'
import { platformConfig } from '../config/platform.config'
import { IPlatform } from '@/render/store/baseconfig/types'
import emitter from '@/render/utils/mitt'
export default defineComponent({
  components: {
    pageCardFormVue
  },
  props: {
    modelValue: {
      type: Object as PropType<IPlatform>,
      default: () => ({})
    }
  },
  emits: ['update:modelValue'],
  setup(props, { emit }) {
    const formData = ref({ ...props.modelValue })
    watch(
      formData,
      (newValue) => {
        emit('update:modelValue', newValue)
        emitter.emit('update-tab', 'emitter')
      },
      {
        deep: true
      }
    )

    return { platformConfig, formData }
  }
})
</script>

<style scoped></style>
